/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package memory;

import java.util.ArrayList;

/**
 *
 * @author Erdiansyah
 */
public class Room {

    public String roomname;
    public User owner;
    public ArrayList<User> userlist;
    public boolean isexit;
    public Category category;
    public boolean ispersistance;
    public ArrayList<Chat> content;

    public Room(String rn, String kat, User o) {
        roomname = rn;
        category = new Category(kat, "0001");
        owner = o;
        isexit = false;
        ispersistance = false;
        userlist = new ArrayList<User>();
        userlist.add(o);
        content = new ArrayList<Chat>();
    }

    public Room(String rn, User o) {
        roomname = rn;
        owner = o;
        isexit = false;
        ispersistance = false;
        userlist = new ArrayList<User>();
        userlist.add(o);
        content = new ArrayList<Chat>();
    }

    public ArrayList<Chat> getContent() {
        return content;
    }

    public void setContent(ArrayList<Chat> content) {
        this.content = content;
    }

    public boolean isIsexit() {
        return isexit;
    }

    public void setIsexit(boolean isexit) {
        this.isexit = isexit;
    }

    public boolean isIspersistance() {
        return ispersistance;
    }

    public void setIspersistance(boolean ispersistance) {
        this.ispersistance = ispersistance;
    }

    public Category getCategory() {
        return category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }

    public User getOwner() {
        return owner;
    }

    public void setOwner(User owner) {
        this.owner = owner;
    }

    public String getRoomname() {
        return roomname;
    }

    public void setRoomname(String roomname) {
        this.roomname = roomname;
    }

    public ArrayList<User> getUserlist() {
        return userlist;
    }

    public void setUserlist(ArrayList<User> userlist) {
        this.userlist = userlist;
    }

    public void addUserToRoom(User user) {
        this.userlist.add(user);
    }

    public void removeUserFromRoom(User user) {
        this.userlist.remove(user);
    }

    public String showInfoRoom(){
        String temp="";
        temp += "RoomName : "+getRoomname()+"<br/>";
        temp += "Owner : "+getOwner().getUsername()+"<br/>";
        temp += "Catergory :"+getCategory().getCategoryname()+"<br/>";
        return temp;
    }
}
